package com.wen.ui;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

/**
 * @Description:
 * @Author: wenxin
 * @Date: 2022/6/24 16:57
 * @Version: 1.0
 */
public class main {
    private JFrame frame;
    private JPanel main;
    private JPanel c;

    public static void main(String[] args) {
        new main();
    }

    public main() {
        init();
        frame = new JFrame("工具箱");
        frame.setContentPane(main);
        frame.setSize(400,400);
        frame.setLocationRelativeTo(null); // 窗口居中
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //frame.pack();
        frame.setVisible(true);
        frame.setIconImage(new ImageIcon("/icon/icon1.png").getImage());
    }

    public void init(){
        c.setBorder(new EmptyBorder(10,10,10,10));
        GridLayout layout=new GridLayout(3,3,10,10);
        //水平间距
        //layout.setHgap(20);
        c.setLayout(layout);
        JButton button1=new JButton("进程端口查询");
        button1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new port();
            }
        });
        c.add(button1);
        JButton button2=new JButton("端口扫描");
        button2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new portScan();
            }
        });
        c.add(button2);
    }
}
